package com.youngwang.lambda;

import java.util.Objects;
import java.util.function.Predicate;

/**
 * @author youngwang
 *         Date: 2016/9/1
 */
public class PredicateTest {

    public static void main(String[] args){

        Predicate<String> predicate = s -> s.length() > 0;
        System.out.println(predicate.test("foo"));
        System.out.println(predicate.negate().test("foo"));

        Predicate<Boolean> nonNull = Objects::nonNull;
        System.out.println(nonNull.test(null));
        Predicate<Boolean> isNull = Objects::isNull;
        System.out.println(isNull.test(null));

        Predicate<String> isEmpty = String::isEmpty;
        System.out.println(isEmpty.test("jhe"));
        Predicate<String> isNotEmpty = isEmpty.negate();
        System.out.println(isNotEmpty.test("jhe"));
    }
}
